package com.example.finalassignment.pojo.response;

/**
 * 基础返回类
 */

public class ResultResponse {
    /**
     * 状态码
     */
    private Integer code;

    /**
     * 返回的消息
     */
    private String message;

    /**
     * 本次操作是否成功
     */
    private Boolean status;

    /**
     * 请求成功
     * @param msg
     * @return
     */
    public static ResultResponse success(String msg) {
        return new ResultResponse(200, msg, Boolean.TRUE);
    }

    /**
     * 请求失败
     * @param code
     * @param msg
     * @return
     */
    public static ResultResponse fail(int code,String msg){
        return new ResultResponse(code,msg,Boolean.FALSE);
    }

    public ResultResponse() {

    }

    public ResultResponse(Integer code, String message, Boolean status) {
        this.code = code;
        this.message = message;
        this.status = status;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "ResultResponse{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", status=" + status +
                '}';
    }
}
